package utils

import (
	"errors"
)

const (
	ErrCodeNotFount  = -1
	ErrCodeInternal  = -10000
	ErrCodeIllParams = 1
)

var ErrCodeMap = map[int]string{
	-1:     "Record not found",
	-10000: "Internal error",
	1:      "Illegal params",
}

type CodedErr struct {
	Code  int
	Error error
}

func GetErrorByCode(code int) *CodedErr {
	return &CodedErr{
		Code:  code,
		Error: errors.New(ErrCodeMap[code]),
	}
}
